
namespace HtERP.Data
{
    /// <summary>
    /// 文件上传请求模型
    /// </summary>
    public class UploadRequest
    {
        public string FileName { get; set; } = string.Empty;
        public long FileSize { get; set; }
        public string FileHash { get; set; } = string.Empty;
        public string FileType { get; set; } = string.Empty;
        public string Description { get; set; } = string.Empty;
        public DateTime UploadTime { get; set; } = DateTime.Now;
        public string BackupScheduleName { get; set; } = string.Empty;
        public string DatabaseName { get; set; } = string.Empty;
        public string DatabaseType { get; set; } = string.Empty;
        public string SourceMachine { get; set; } = Environment.MachineName;
    }

    /// <summary>
    /// 文件上传响应模型
    /// </summary>
    public class UploadResponse
    {
        public bool Success { get; set; }
        public string? FileId { get; set; } = string.Empty;
        public string Message { get; set; } = string.Empty;
    }

    /// <summary>
    /// 上传状态模型
    /// </summary>
    public class UploadStatus
    {
        public string? FileId { get; set; } = string.Empty;
        public long UploadedBytes { get; set; }
        public long TotalBytes { get; set; }
        public int ProgressPercentage => (int)((double)UploadedBytes / TotalBytes * 100);
        public bool Completed { get; set; }
        public string ErrorMessage { get; set; } = string.Empty;
    }

    /// <summary>
    /// 分块上传请求模型
    /// </summary>
    public class UploadChunkRequest
    {
        public string FileId { get; set; } = string.Empty;
        public int ChunkIndex { get; set; }
        public int TotalChunks { get; set; }
        public long ChunkSize { get; set; }
        public byte[] ChunkData { get; set; } = Array.Empty<byte>();
    }

    /// <summary>
    /// 分块上传响应模型
    /// </summary>
    public class UploadChunkResponse
    {
        public bool Success { get; set; }
        public string Message { get; set; } = string.Empty;
        public int CurrentChunk { get; set; }
        public int TotalChunks { get; set; }
    }

    //---------------------------------------------------同DbBackTool---------------------------------------------------
    /// <summary>
    /// 文件上传会话请求
    /// </summary>
    public class FileUploadSessionRequest
    {
        public string FileName { get; set; } = string.Empty;
        public long FileSize { get; set; }
    }

    /// <summary>
    /// 上传会话响应
    /// </summary>
    public class UploadSessionResponse
    {
        public string UploadId { get; set; } = string.Empty;
    }

    /// <summary>
    /// 文件上传响应
    /// </summary>
    public class FileUploadResponse
    {
        public int Id { get; set; }
        public string FileName { get; set; } = string.Empty;
        public string ContentType { get; set; } = string.Empty;
        public long FileSize { get; set; }
        public DateTime UploadedAt { get; set; }
        public string DownloadUrl { get; set; } = string.Empty;
        public string FileUrl { get; set; } = string.Empty;
        public bool Success { get; set; } = true;
        public string ErrorMessage { get; set; } = string.Empty;
    }

    /// <summary>
    /// API响应基类
    /// </summary>
    public class ApiResponse<T>
    {
        public bool Success { get; set; }
        public T? Data { get; set; }
        public string Message { get; set; } = string.Empty;
    }


}